package Zoo.View.LeaderView;

import Zoo.Entity.ZoomenEntity;
import Zoo.Handler.DeleteZoomenViewHandler;
import Zoo.View.LeaderView.LeaderView1;

import javax.swing.*;
import java.awt.*;

/**
 * 1、DeleteZoomenView用于园长删除动物饲养员
 */
public class DeleteZoomenView extends JDialog {
    JPanel jPanel=new JPanel();
    //此处是通过园区id来找对应园区，所以不能修改园区id，
    JLabel idLable =new JLabel("饲养员id");
    JTextField idTxt=new JTextField();

    JButton deleteBtn =new JButton("删除");

    DeleteZoomenViewHandler deleteZoomenViewHandler;
    public DeleteZoomenView(LeaderView1 leaderView1){
        super(leaderView1,"删除动物饲养员信息",true);

        deleteZoomenViewHandler=new DeleteZoomenViewHandler(this,leaderView1);

//        LeaderService leaderService=new LeaderServiceImpl();
//        ZoomenEntity zoomenEntity=leaderService.getById(selectedZooparkId);

        idLable.setPreferredSize(new Dimension(80,30));
        jPanel.add(idLable);
        idTxt.setPreferredSize(new Dimension(200,30));
        jPanel.add(idTxt);


        Container contentPane=getContentPane();
        contentPane.add(jPanel);

        deleteBtn.addActionListener(deleteZoomenViewHandler);
        jPanel.add(deleteBtn);

        setSize(350,500);
        setLocationRelativeTo(null);
        //DISPOSE_ON_CLOSE：只销毁当前的窗体
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
        setResizable(false);
        setVisible(true);


    }

    //获取修改后的园区对象（但园区id是需要修改对象的园区id）
    public ZoomenEntity buildDeletedZoomenEntity() {
        ZoomenEntity zoomenEntity=new ZoomenEntity();
        zoomenEntity.setId(Integer.valueOf(idTxt.getText()));


        return zoomenEntity;
    }
}
